package com.tql.view.service.impl;

import com.github.pagehelper.PageHelper;
import com.tql.view.mapper.SceneryMapper;
import com.tql.view.pojo.Scenery;
import com.tql.view.service.SceneryService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SceneryServiceImpl implements SceneryService {
    @Autowired
    private SceneryMapper sceneryMapper;

    @Override
    public List<Scenery> getScenery(String mytype, Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return sceneryMapper.getScenery(mytype,page,size);
    }

    @Override
    public Scenery getSceneryById(String id) {
        return sceneryMapper.getSceneryById(id);
    }

    @Override
    public void deleteScenery(String id) {
        sceneryMapper.deleteScenery(id);
    }

    @Override
    public void insertScenery(Map<String, Object> params) {
        sceneryMapper.insertScenery(params);
    }

    @Override
    public List<Scenery> searchByName(String myname,Integer page, Integer size) {
        PageHelper.startPage(page,size);
       return  sceneryMapper.searchByName(myname,page,size);
    }

    @Override
    public void updatePageView(String id) {
        sceneryMapper.updatePageView(id);
    }

    @Override
    public List<Scenery> getSceneryByPageView(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return sceneryMapper.getSceneryByPageView(page,size);
    }

    @Override
    public List<Scenery> getSceneryByDownLoad(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        return sceneryMapper.getSceneryByDownLoad(page,size);
    }

    @Override
    public void updateDownload(String id) {
        sceneryMapper.updateDownload(id);
    }
}
